<?php
ob_start();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Merchandise :: Hambaa.com</title>
<link rel="stylesheet" type="text/css" href="styles/Graphitti_style.css" />
<link rel="stylesheet" type="text/css" href="styles/Cart.css" />
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="javascript/cart.js"></script>
<script type="text/javascript">
function submitform(){
	//alert('hi');
	var formId = document.getElementById('generatePdf');
	formId.action = 'order_summary_pdf.php';
	formId.submit();	

}



 $(document).ready(function(){
$("#retrieveOrderDetails").click(function(){

document.getElementById('orderInquiry').style.display = "none";	

document.getElementById('loading').style.display = "block";
var orderId=document.getElementById('orderId').value;
var email=document.getElementById('email').value;

document.getElementById('pdforderid').value=orderId;
document.getElementById('pdfemail').value=email;

//alert(email);
//alert(orderId);
//alert(qty);
$.ajax({url:"rest/data/getOrderDetails.php",
type:'GET',
data : {orderId:orderId,email:email},
success:function(result){
		order = JSON.parse(result);

if(order.orders=='false'){
	document.getElementById('orderInquiry').style.display = "block";
	document.getElementById('loading').style.display = "none";
	document.getElementById('ordersfalse').style.display = "block";
	}	

else{

$("#orderNo").html(orderId);
$("#dateOrder").html(order.dateOrder);
var address=order.fname+' '+order.lname+'<br>'+order.addr1+'<br>'+order.addr2+'<br>'+order.city+'<br>'+order.state+' '+order.pincode+'<hr>Contact No.: '+order.contactNo;
$("#tx_shipping_addr").html(address);
$("#statusOrder").html(order.statusOrder);

var table = '<table border="0" width="715" cellpadding="0"><tr><td colspan="2"><h4>Product</h4></td><td width="125"><h4>Shipping Date*</h4></td><td width="125"><h4>Delivery Date*</h4></td><td width="50"><h4>Price</h4></td><td width="50"><h4>Qty.</h4></td><td width="85"><h4>Sub Total</h4></td></tr>';

var i;
var row="";
var subTotal=0;
var grandTotal=0;
for (i in order.order)
{
	subTotal=(order.order[i].quantity*order.order[i].price);
	row="<tr align='center'><td width='60'><a href='details.php?productId="+order.order[i].id_product+"'><img  src='images/tshirts/ts"+order.order[i].id_product+".jpg'  height='60' width='60'></a></td><td>"+order.order[i].nm_product+"</td><td>"+order.order[i].dateShipment+"</td><td>"+order.order[i].dateDelivery+"</td><td>"+order.order[i].price+"</td><td>"+order.order[i].quantity+"</td><td>"+subTotal+"</td></tr>";
	grandTotal+=subTotal;
	table=table+row;
}
//alert(row);
table=table+'<tr align="center"><td colspan="2"><h3>Grand Total</h3></td><td></td><td></td><td></td><td>Rs.</td><td width="85"><h4>'+grandTotal+' /-</h4></td></tr></table>';
$("#producttable").html(table);
$("#noofitems").html(++i);


document.getElementById('loading').style.display = "none";	

document.getElementById('orderDetails').style.display = "block";
}
},
error:function(result){
	
}
});
});
});

</script>




</head>

<body>
<table id="headertable" border="0" align="center" width="950" height="118"  >
<tr >
<td height="114" align="right" valign="bottom">
<a href="index.php"><img src="images/logopng.png" width="103" height="99" /></a></td>
<td align="left" valign="top">
<a href="index.php"><img src="images/hambaa_logo_newjpg.jpg" width="308" height="107" /></a>
</td>
<td valign="top" align="right">
    <table id="containertable" cellpadding="0" cellspacing="0" border="0">
    <tr>
    <td align="right">
        <div id="menulinks">
        <a href="index.php" class="active">Home</a>
        <a href="offers.php">Offers</a>
        <a href="about_us.php">About Us</a>
        <a href="contact_us.php">Contact Us</a>
        </div>
    </td>
    </tr>
    </table></td>
</tr>
</table>


<table id="hotitem_cart" border="0" width="950"  align="center" bgcolor="#FFFFFF" >
<tr>
<td width="8"></td>
<td width="356">
Order for your tshirt from our wide range.<br>
What's better, now you can create your own design! 
</td>
<td width="164"><img src="images/hot_items.png" width="164" height="61" /></td>
<td width="55">
        <img src="images/tshirts/ts1.jpg" height="55" width="55" />
</td>
        <td width="55">
        <img src="images/tshirts/ts2.jpg" height="55" width="55" />
        </td>
        <td width="55">
        <img src="images/tshirts/ts3.jpg" height="55" width="55" />
        </td>
         <td width="55">
        <img src="images/tshirts/ts4.jpg" height="55" width="55"  />
        </td>	

<td  align="right" width="150" >

<a href = "javascript:void(0)" class="cartbtn" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block';getShoppingCart()"><table border="0" ><tr><td><img src="images/shopping_cart1.png" width="41" height="41" /></td>
<td>Cart(<span  id="order_count"></span>)</td></tr></table></a>

<div id="light" class="white_content" >
        <div id="close_button" style="position:fixed;width:inherit;float:right" >
        <a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'"   ><img src="images/Close-button.png"  /></a>
        </div>   
 		<div id="table_container" style="overflow:auto" >
			<!--table created here-->             
        </div>
    </div>

	<div id="fade" class="black_overlay" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'" />
    
</td>
</tr>

</table>


<table id="outertable" border="0" width="950" height="269" align="center" bgcolor="#FFFFFF" >

<tr >
<td  align="center" valign="top">
<div id="orderInquiry" >

<form>
<table border="0" align="center" cellpadding="5">
<tr><td colspan="4" align="center"><h1>Track My Order</h1></td></tr>
<tr>
<td>Email:</td><td> <input type="text" id="email" name="email" /></td><td rowspan="2"><img src="images/separator.png" />
</td>
<td rowspan="2">
<a href="#" id="retrieveOrderDetails" class="wishbtn" >Submit</a>
</td>
</tr>
<tr>
<td>
Orderid:</td><td> <input type="text" id="orderId" name="orderId" /></td>
</tr>
<tr><td colspan="4" align="center">

<span id="ordersfalse" style="color:#F00;display:none;">No orders found. Please try again</span>

</td></tr>

</table>
</form>

</div>

<div id="loading" style="display:none;padding-top:100px;" ><img src="images/loading.gif" /></div>

    <div id="orderDetails" style="display:none">
    <table border="0" width="715"  >
    <tr>
    <td align="center" colspan="3"><h1>Order Details(<span id="noofitems"></span> items)</h1></td>
    </tr>
    <tr valign="top" align="center">
    <td width="210">
    	<table border="0"  cellpadding="5" >
       	<tr><td><h4>Order Summary</h4></td></tr>
   		<tr><td>Order No. : <span id="orderNo"></span></td></tr>
    	<tr><td>Date : <span id="dateOrder"></span></td></tr>
    	<tr><td>Order status : <span id="statusOrder"></span> </td></tr>
        <tr><td><hr />
            	
    	<a href="#" onclick="submitform()"><span style="background-color:#0099CC;  padding:5px; ">Download pdf <img src="images/pdf/pdf-icon.gif" /></span></a>
    
    	</td></tr>
    	</table>
    
    </td>
    <td>
    
    	<table border="0" cellpadding="5" width="100%">
    	<tr><td><h4>Shipping Address</h4></td></tr>
    	<tr><td><span id="tx_shipping_addr"></span></td></tr>
    	</table>
    </td>
    <td width="210">
    	<table border="0" cellpadding="5">
    	<tr><td><h4>Shipped On</h4></td></tr>
    	<tr><td> 20th Apr 13, 10:05 PM<?php echo $row_orders['dt_order'] ?></td></tr>
    	<tr><td><h4>Delivered On</h4></td></tr>
    	<tr><td> 20th Apr 13, 10:05 PM<?php echo $row_orders['dt_order'] ?></td></tr>
    	<tr><td><hr /><span style="color:#F00;text-align:left">Payment : Cash On Delivery</span></td></tr>
    	</table>
    </td>
    </tr>
    
    </table>
    
    
        <div id="producttable"></div>
        
   
    
</div>    

</td>

<td width="200" valign="top">
	<table id="innerright" border="0" cellspacing="2"  width="200" align="right" background="images/tableback3.png" >
	<tr><td height="176"><h3>Recommended for you</h3></td></tr>
    <tr><td align="center" bgcolor="#FFFFFF" valign="middle">
    <a href = "mywishlist.php?timefilter=all" class="wishbtn" > My Wishlist</a><br><br>
    </td></tr>
    <tr><td bgcolor="#FF6666">
    <h6>We'd like to hear from you</h6>
    </td></tr>
	<tr align="center" ><td align="center"> 
    <h2><a href="suggest.php">Make your Suggestion</a></h2>
    </td></tr>
    </table>
 
</td>

</tr>
</table>



<br>

<div id="footer" > 


<table border="0" width="952" height=154 align="center" >
<tr>
<td >
<h1>My Hambaa</h1>
</td>
<td >
<h1>Shopping Policies</h1>
</td>
<td >
<h1>Payment Information</h1>
</td>
<td >
<h1>Contact Us</h1>
</td>
</tr>

<tr>
<td>
<a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block';getShoppingCart1()">My Cart</a> |
<a href="about_us.php">My Order</a> |
<a href="about_us.php">FAQs</a>
</td>

<td >
<a href="about_us.php">Return Policy</a> |
<a href="about_us.php">Refund Policy</a> |
<a href="about_us.php">Terms and Conditions</a>
</td>

<td >
<a href="about_us.php">Payment Options: </a>COD
</td>

<td >
e-mail:
<a href="mailto:care@hambaa.com">care@hambaa.com</a>
</td>
</tr>

<tr align="center"><td colspan="4">
<hr />

&copy;2012 All Rights Reserved by <a href="index.php">www.hambaa.com</a>
</td></tr>
</table>
</div>

<?php 
ob_end_flush();
?>


<form id="generatePdf" method="POST" target="_blank" >
<input type="hidden" id="pdfemail" name="pdfemail" />
<input type="hidden" id="pdforderid" name="pdforderid" />
</form>
</body>
</html>

